import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

let routes = [];

// 路径解析,自动获取router下所有js的数组拼接
function analysis(resolve) {
  resolve.keys().forEach(key=>{
    if(key.indexOf('children')<0){
      routes=routes.concat(resolve(key).default);
    }
  });
}

analysis(require.context('@/router/',true,/\.js$/));

export default new Router({
  linkExactActiveClass:'eCurr',
  linkActiveClass:'curr',
  mode:'hash',
  routes:routes
})
